package a.b;

import a.c.q;
import a.c.v;
import a.c.z;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

public class d
{
  private static final b[] a = new b[0];
  private final k b = new k(this, 3);
  private final k c = new k(this, 0);
  private final k d = new k(this, 4);
  private int e = 120;
  private double f;
  private final z g;
  private final List h;
  private Timer i;
  private boolean j;
  private boolean k;
  private boolean l;
  private volatile boolean m;
  public static int n;
  public static boolean o;
  
  public d()
  {
    this(1.0D, true);
  }
  
  public d(double paramDouble, boolean paramBoolean)
  {
    this.f = paramDouble;
    this.g = new z();
    this.h = new ArrayList(2);
    this.i = null;
    this.j = paramBoolean;
    this.k = true;
    this.l = true;
    if ((bool) || (i1 != 0))
    {
      if (!bool) {}
      q.n = !q.n;
    }
    if (bool) {
      q.o = !q.o;
    }
  }
  
  public d(double paramDouble)
  {
    this(paramDouble, true);
  }
  
  public d(boolean paramBoolean)
  {
    this(1.0D, paramBoolean);
  }
  
  public void a(b paramb)
  {
    if (paramb == null) {
      return;
    }
    synchronized (this.h)
    {
      this.h.add(paramb);
    }
  }
  
  public void b(b paramb)
  {
    if (paramb == null) {
      return;
    }
    synchronized (this.h)
    {
      this.h.remove(paramb);
    }
  }
  
  public int a()
  {
    return this.e;
  }
  
  public void a(int paramInt)
  {
    this.e = paramInt;
  }
  
  public boolean b()
  {
    return this.k;
  }
  
  public void a(boolean paramBoolean)
  {
    this.k = paramBoolean;
  }
  
  public boolean c()
  {
    return this.l;
  }
  
  public boolean d()
  {
    return this.j;
  }
  
  public void b(boolean paramBoolean)
  {
    this.j = paramBoolean;
  }
  
  public void a(c paramc)
  {
    boolean bool = o;
    this.l = EventQueue.isDispatchThread();
    if (!bool) {
      if (this.j)
      {
        if (bool) {
          break label39;
        }
        c(paramc);
        if (n == 0) {
          return;
        }
      }
    }
    label39:
    b(paramc);
  }
  
  private void b(c paramc)
  {
    if (!o)
    {
      if (this.i == null) {
        c(this.b);
      }
      a(new f_(paramc));
    }
    synchronized (this.g)
    {
      this.g.add(new c_(paramc));
    }
    i();
  }
  
  private void c(c paramc)
  {
    boolean bool = o;
    int i1 = n;
    this.m = true;
    try
    {
      a(this.b);
      a(new f_(paramc));
      e_ locale_ = new e_(paramc);
      long l1 = paramc.c();
      if (!bool) {}
      long l2 = 0L < l1 ? (l1 / this.f) : 0L;
      if (!bool)
      {
        if (l2 > 0L)
        {
          long l3 = Math.max(1L, 1000L / this.e);
          double d1 = 0.0D;
          long l4 = 0L;
          long l5 = System.currentTimeMillis();
          do
          {
            if (d1 >= 1.0D) {
              break;
            }
            if (bool) {
              break label262;
            }
            if (i1 != 0) {
              break label261;
            }
            if (!this.m) {
              break;
            }
            locale_.a(d1);
            a(locale_);
            a(this.c);
            l4 += l3;
            long l6 = l4 - System.currentTimeMillis() + l5;
            if (!bool)
            {
              if (l6 > 10L) {
                try
                {
                  Thread.sleep(l6);
                }
                catch (Exception localException) {}
              }
              d1 = (System.currentTimeMillis() - l5) / l2;
            }
          } while (i1 == 0);
        }
        locale_.a(1.0D);
        a(locale_);
        a(this.c);
        a(new d_(paramc));
        a(this.d);
        if (bool) {
          return;
        }
      }
    }
    finally
    {
      label261:
      label262:
      this.m = false;
    }
  }
  
  public boolean e()
  {
    boolean bool = o;
    if ((bool) || (this.i == null)) {
      if (bool) {
        break label27;
      }
    }
    label27:
    return this.m;
  }
  
  public double f()
  {
    return this.f;
  }
  
  public void a(double paramDouble)
  {
    this.f = paramDouble;
  }
  
  public void g()
  {
    this.f *= 1.5D;
  }
  
  public void h()
  {
    this.f /= 1.5D;
    if ((o) || (this.f == 0.0D)) {
      this.f = 0.01D;
    }
  }
  
  private void i()
  {
    if (!o)
    {
      if (this.i == null)
      {
        this.i = new Timer(1000 / this.e, new b_(null));
        this.i.setInitialDelay(0);
      }
    }
    else {
      this.i.start();
    }
  }
  
  public void j()
  {
    boolean bool = o;
    int i1 = n;
    if (!bool) {
      if (this.m)
      {
        if (bool) {
          break label62;
        }
        this.m = false;
        if (i1 == 0) {
          break label61;
        }
      }
    }
    if (!bool) {
      if (this.i != null)
      {
        this.i.stop();
        this.i = null;
      }
    }
    label61:
    synchronized (this.g)
    {
      label62:
      if (!bool) {
        if (this.g != null)
        {
          v localv = this.g.f();
          if (localv != null) {
            ((c_)localv.c()).a.b();
          }
          while (bool)
          {
            this.g.h(localv);
            localv = localv.a();
            if ((!bool) && (i1 != 0)) {
              return;
            }
            if (i1 == 0) {
              break;
            }
          }
          c(this.d);
        }
      }
    }
  }
  
  private void k()
  {
    if ((o) || (this.i != null))
    {
      this.i.stop();
      this.i = null;
      c(this.d);
    }
  }
  
  private void a(Runnable paramRunnable)
  {
    boolean bool = o;
    if ((bool) || ((this.k) && (!EventQueue.isDispatchThread()))) {
      try
      {
        EventQueue.invokeAndWait(paramRunnable);
      }
      catch (InvocationTargetException localInvocationTargetException)
      {
        if (!bool) {
          if ((localInvocationTargetException.getTargetException() instanceof RuntimeException)) {
            throw ((RuntimeException)localInvocationTargetException.getTargetException());
          }
        }
        if ((bool) || ((localInvocationTargetException.getTargetException() instanceof Error))) {
          throw ((Error)localInvocationTargetException.getTargetException());
        }
        throw new RuntimeException(localInvocationTargetException.toString());
      }
      catch (InterruptedException localInterruptedException)
      {
        if (n == 0) {
          return;
        }
      }
    } else {
      paramRunnable.run();
    }
  }
  
  private void a(k paramk)
  {
    boolean bool = o;
    int i3 = n;
    if (null != this.h)
    {
      if (!bool)
      {
        if (this.h.isEmpty()) {
          return;
        }
        if (bool) {}
      }
      else if (this.k)
      {
        if (!EventQueue.isDispatchThread())
        {
          arrayOfb = (b[])this.h.toArray(a);
          try
          {
            EventQueue.invokeAndWait(new Runnable()
            {
              private final b[] val$al;
              private final k val$event;
              
              public void run()
              {
                boolean bool = d.o;
                int k = d.n;
                int i = 0;
                do
                {
                  int j = this.val$al.length;
                  while (k == 0)
                  {
                    if (i >= j) {
                      break;
                    }
                    this.val$al[i].a(this.val$event);
                    i++;
                  }
                } while (bool);
              }
            });
          }
          catch (InvocationTargetException localInvocationTargetException)
          {
            if (!bool) {
              if ((localInvocationTargetException.getTargetException() instanceof RuntimeException)) {
                throw ((RuntimeException)localInvocationTargetException.getTargetException());
              }
            }
            if ((bool) || ((localInvocationTargetException.getTargetException() instanceof Error))) {
              throw ((Error)localInvocationTargetException.getTargetException());
            }
            throw new RuntimeException(localInvocationTargetException.toString());
          }
          catch (InterruptedException localInterruptedException)
          {
            if (bool) {
              break label172;
            }
          }
          if (i3 == 0) {
            return;
          }
        }
      }
      b[] arrayOfb = (b[])this.h.toArray(a);
      label172:
      int i1 = 0;
      int i2 = arrayOfb.length;
      do
      {
        if (i1 >= i2) {
          break;
        }
        arrayOfb[i1].a(paramk);
        i1++;
      } while (i3 == 0);
    }
  }
  
  private void c(k paramk)
  {
    boolean bool = o;
    int i3 = n;
    synchronized (this.h)
    {
      if (!bool) {
        if (this.h.isEmpty()) {
          return;
        }
      }
      b[] arrayOfb = (b[])this.h.toArray(a);
      int i1 = 0;
      int i2 = arrayOfb.length;
      if (i1 < i2)
      {
        arrayOfb[i1].a(paramk);
        i1++;
      }
      while (bool)
      {
        if ((!bool) && (i3 != 0)) {
          return;
        }
        if (i3 == 0) {
          break;
        }
      }
    }
  }
  
  private static final class d_
    implements Runnable
  {
    private final c a;
    
    public d_(c paramc)
    {
      this.a = paramc;
    }
    
    public void run()
    {
      this.a.b();
    }
  }
  
  private static final class e_
    implements Runnable
  {
    private final c a;
    private double b;
    
    public e_(c paramc)
    {
      this.a = paramc;
      this.b = 0.0D;
    }
    
    public double a()
    {
      return this.b;
    }
    
    public void a(double paramDouble)
    {
      this.b = paramDouble;
    }
    
    public void run()
    {
      this.a.a(this.b);
    }
  }
  
  private static final class f_
    implements Runnable
  {
    private final c a;
    
    public f_(c paramc)
    {
      this.a = paramc;
    }
    
    public void run()
    {
      this.a.a();
    }
  }
  
  private final class b_
    implements ActionListener
  {
    private b_() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      boolean bool = d.o;
      int j = d.n;
      int i = 1;
      synchronized (d.this.g)
      {
        if (!bool) {
          if (d.this.g == null) {
            return;
          }
        }
        if (!bool) {}
        i = !d.this.g.isEmpty() ? 1 : 0;
        if (!bool)
        {
          if (i != 0)
          {
            v localv = d.this.g.f();
            do
            {
              if (localv == null) {
                break;
              }
              d.c_ localc_ = (d.c_)localv.c();
              if (j != 0) {
                break label156;
              }
              if (localc_.a()) {
                d.this.g.h(localv);
              }
              localv = localv.a();
            } while (j == 0);
          }
          if (bool) {
            break label183;
          }
        }
      }
      if (i != 0)
      {
        label156:
        if (bool) {
          break label187;
        }
        d.this.c(d.this.c);
        if (j == 0) {
          return;
        }
      }
      label183:
      label187:
      d.this.k();
    }
    
    b_(d.0 param0)
    {
      this();
    }
  }
  
  private final class c_
  {
    private final c a;
    private long b;
    private long c;
    
    c_(c paramc)
    {
      this.a = paramc;
      this.b = -1L;
      this.c = -1L;
    }
    
    boolean a()
    {
      boolean bool = d.o;
      if (!bool) {
        if (this.c < 0L)
        {
          long l = this.a.c();
          if (!bool) {}
          this.b = (0L < l ? (l / d.this.f) : 0L);
          this.c = System.currentTimeMillis();
        }
      }
      double d = (bool) || (0L < this.b) ? (System.currentTimeMillis() - this.c) / this.b : 1.0D;
      if (!bool)
      {
        if (d < 1.0D)
        {
          this.a.a(d);
          return false;
        }
        this.a.a(1.0D);
        this.a.b();
      }
      return true;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.b.d

 * JD-Core Version:    0.7.0.1

 */